package com.hzit.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.hzit.dto.ClassesDTO;
import com.hzit.entity.Classes;
import com.hzit.mapper.ClassesMapper;
import com.hzit.service.IClassesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@Service
public class ClassesServiceImpl implements IClassesService {
	@Autowired
	private ClassesMapper classesMapper;
	//1. 查询所有班级
	@Override
	public List<ClassesDTO> findAll() {
		List<Classes> classes = classesMapper.selectByExample(null);
		return classes.stream().map(m -> {
			ClassesDTO dto = new ClassesDTO();
			BeanUtil.copyProperties(m,dto,true);
			return dto;
		}).collect(Collectors.toList());
	}
}
